package com.tanhua.server.service;

import com.tanhua.dubbo.api.UserLocationApi;
import com.tanhua.model.vo.ErrorResult;
import com.tanhua.server.exeception.BusinessException;
import com.tanhua.server.interceptor.UserHolder;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

/**
 * @author SunSun
 * @date 2021/10/31
 */
@Service
public class BaiduService {

    @DubboReference
    private UserLocationApi userLocationApi;

    public void updateLocation(Double longitude, Double latitude, String address) {
        boolean update=userLocationApi.updateLocation(UserHolder.getUserId(),longitude,latitude,address);
        if(!update){
            throw  new BusinessException(ErrorResult.error());
        }
    }
}
